import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import login from "../views/Login.vue";
import upsert from "../views/commodity/Upsert.vue";
import commodity from "./commodity";// 商品
import generalize from "./generalize";// 推广
import system from "./system";// 系统
import operation from "./operation"// 运营
Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    component: Home,
    // redirect: "/Home/directory",
    redirect: "/login",
  },
  {
    path: '/login',
    component: login,
    // redirect: "/Home/directory",
  },
  {
    path: "/Home",
    component: Home,
    // redirect: "/directory",
    children: [
      {
        path: 'Directory',
        component: () => import('../views/Directory.vue'),
         meta:{title: "首页"}
      },
      {
        path: '/Blank',//空白页面
        component: () => import('../views/Blank.vue'),
      }
    ]
  },
  // 运营
  {
    path: '/operation',
    name: '运营管理',
    component: () => import('../views/Home.vue'),
    children: [
      ...operation
    ]
  },
  // 商品
  {
    path: '/commodity',
    name: '商品管理',
    component: () => import('../views/Home.vue'),
    children: [
      ...commodity,
    ]
  },
  // 推广
  {
    path: '/generalize',
    name: "推广管理",
    component: () => import('../views/Home.vue'),
    children: [
      ...generalize
    ]
  },
  // 系统
  {
    path: '/system',
    name: "系统管理",
    component: () => import('../views/Home.vue'),
    children: [
      ...system
    ]
  }
];

const router = new VueRouter({
  routes
});

export default router;
